﻿using Microsoft.EntityFrameworkCore;
using MyEartags.PairVariety;
using System;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace MyEartags.EntityFrameworkCore;

public static class MyEartagsDbContextModelCreatingExtensions
{
    public static void ConfigureMyEartags(
        this ModelBuilder builder)
    {
        Check.NotNull(builder, nameof(builder));

        /* Configure all entities here. Example:

        builder.Entity<Question>(b =>
        {
            //Configure table & schema name
            b.ToTable(MyEartagsDbProperties.DbTablePrefix + "Questions", MyEartagsDbProperties.DbSchema);

            b.ConfigureByConvention();                                 

            //Properties
            b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength);

            //Relations
            b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId);

            //Indexes
            b.HasIndex(q => q.CreationTime);
        });
        */

        //builder.Entity<Variety>(b => {
        //    b.ToTable("Varieties");
        //    b.ConfigureByConvention();
        //    b.Property(v => v.VarietyName).IsRequired().HasMaxLength(100);
        //});
    }
}
